use proc_macro::TokenStream;
use quote::quote;
use syn::Expr;

#[proc_macro]
pub fn compare_max(input: TokenStream) -> TokenStream {
    let input = input.to_string();
    let mut iter = input.split(',');

    let left = iter.next().unwrap().trim();
    let right = iter.next().unwrap().trim();

    let left_expr: Expr = syn::parse_str(left).unwrap();
    let right_expr: Expr = syn::parse_str(right).unwrap();

    let gen = quote! {
        {
            std::cmp::max(#left_expr, #right_expr)
        }
    };

    gen.into()
}
